package org.trc.traffic;

import java.util.GregorianCalendar;
import java.text.SimpleDateFormat;

public class BasicLinkTraffic {
	public String carID;
	public String linkID;
	public int travelTime;
	public float travelSpeed;
    public int enterTime; // seconds
    public float weight;
    
    public GregorianCalendar timestamp;
    
    public BasicLinkTraffic(String carID, String linkID, int enterTime, int travelTime, float travelSpeed){
    	this.carID = carID;
    	this.linkID = linkID;
    	this.enterTime = enterTime;
    	this.travelTime = travelTime;
    	this.travelSpeed = travelSpeed;
    	this.timestamp = new GregorianCalendar(2008, 11, 28, enterTime / 3600, enterTime % 3600 / 60, enterTime % 3600 % 60);
    }
    
    public BasicLinkTraffic(String carID, String linkID, int enterTime, int travelTime, float travelSpeed, float weight){
    	this(carID, linkID, enterTime, travelTime, travelSpeed);
    	this.weight = weight;
    }
    
	public String  getTimeString(){ //"2008-12-28 08:00:12"
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		return dateFormat.format(timestamp.getTime());
	}

}
